# 用户登录验证
#
# 用户依次输入用户名和密码，然后提交验证
# 用户不存在、密码错误，都显示用户名或密码错误提示
# 错误3次，则退出程序
# 验证成功则显示登录信息

USER="tom"
PASSWD="tom123"


for i in range(1,4):
    name=input("input your name:")
    if name == USER:
        passwd = input("input your password:")
        if passwd == PASSWD:
            print("OK name:{}, password:{}".format(name,passwd))
            exit(0)
        else:
            print("the password your input is wrong, you have {} times to input.".format(3-i))
    else:
        print("the username your input is wrong, you have {} times to input.".format(3-i))
        i+=1

